<template>
  <view class="my-info card relative m-10px mt-100px">
    <u-avatar class="user-avatar" size="80px" :src="user.userInfo?.headUrl"/>
    <template v-if="user?.userInfo?.name">
      <view class="text-center">
        <label>
          <label class="text-slate-600 font-bold">{{user.userInfo?.name}}</label> | <label class="text-slate-500">{{user.userInfo?.school?.name}}</label>
        </label>
      </view>
    </template>
    <template v-else>
      <view class="text-center">
        <label @click="handlerLoginClick">点击登录</label>
      </view>
    </template>
  </view>
</template>

<script setup lang="ts">
import UAvatar from "@/uni_modules/uview-plus/components/u-avatar/u-avatar.vue";
import userStore from '@/store/user'

const user = userStore()

// 登录文字点击事件
const handlerLoginClick = () => {
  console.log('点击登录文字点击事件')
  uni.navigateTo({
    url: '/pages/auth/index'
  })
}
</script>

<style lang="scss">
.my-info{
  padding-top: 50px;
}
</style>
